cmake_minimum_required(VERSION 3.16)
project(cpp_plugin_framework)


# 配置编译选项,  -o  -g  
set(CMAKE_CXX_STANDARD 14)
# set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -g -O2)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -g)

find_library(LIB_ASAN /usr/lib64/ libasan.so)
if(LIB_ASAN)
    message(STATUS "-----${LIB_ASAN}------")
elseif()
    message(STATUS "-----not found---")
endif()

# 配置最终的可执行文件的输出路径,
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# 设置环境变量,
set(HOME ${PROJECT_SOURCE_DIR})
set(THIRD_PARTY ${PROJECT_SOURCE_DIR}/3rd)
set(COMMON_HOME ${PROJECT_SOURCE_DIR}/common)
set(CORE_HOME ${PROJECT_SOURCE_DIR}/core)
set(PLUGIN_HOME ${PROJECT_SOURCE_DIR}/plugins)

# 公共的,
include_directories("3rd/easylogging" "3rd/httplib" "common")
aux_source_directory(${COMMON_HOME} COMMON_SRC_LIST)
aux_source_directory(${CORE_HOME} CORE_SRC_LIST)
aux_source_directory(${THIRD_PARTY}/easylogging ELOG_SRC_LIST) 
# 不能用 aux_source_directory("3rd/easylogging" ELOG_SRC_LIST), 这样会找相对路径,
# 这里不再使用 ${ELOG_SRC_LIST} 源文件, 而是作为一个动态库来使用,


# build easylogging shared library
add_subdirectory(common) 

# 指定搜索的子目录,
add_subdirectory(src)       
add_subdirectory(plugins) 
add_subdirectory(config)     
add_subdirectory(test)      


